<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php /** @var $this Mage_Sales_Block_Order_Info */ ?>
<?php $_order = $this->getOrder() ?>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<div class="page-title">
    <h1><?php echo $this->__('Order No. %s', $_order->getRealOrderId()) ?></h1>   
</div>
<div id="order-info">
	<ul>
		<li class="order-tab">
			<a href="#orderPanel">Order Information</a>
		</li>
		<li class="invoice-tab">
			<a href="#invoicePanel">Invoice</a>
		</li>
	</ul>
	<div id="orderPanel">
		<?php if (!$_order->getIsVirtual()): ?>
		<div class="col2-set order-info-box">
			<div class="col-1">
				<div class="box">
					<div class="box-title">
						<h2><?php echo $this->__('Billing Address') ?></h2>
					</div>
					<div class="box-content">
						<address><?php echo $_order->getBillingAddress()->format('html') ?></address>
					</div>
				</div>
			</div>
			<div class="col-2">
				<div class="box">
					<div class="box-title">
						<h2><?php echo $this->__('Shipping Address') ?></h2>
					</div>
					<div class="box-content">
						<address><?php echo $_order->getShippingAddress()->format('html') ?></address>
					</div>
				</div>
			</div>
		</div>
		<?php endif; ?>
		<div class="box box-payment">
			<div class="box-title">
				<h2><?php echo $this->__('Payment Method') ?></h2>
			</div>
			<div class="box-content">
				<?php echo $this->getPaymentInfoHtml() ?>
			</div>
		</div>
		<?php echo $this->getChildHtml('sales_order_view') ?>
		<?php
			$allowPrintStatus = array('complete','paypal_complete','processing','paypal_processing','enets_processing');
		?>
		<?php if(in_array($_order->getStatus(),$allowPrintStatus) || $_order->getInvoiceCollection()->getSize() > 0):?>
		<div class="action">
			<button class="button" onclick="window.open('<?php echo $this->getUrl('sales/order/print', array('order_id' => $_order->getId()))?>', '_blank'); window.focus();"><span><span>print</span></span></button>
		</div>
		<?php endif?>
	</div>
	<div id="invoicePanel">
	<?php if($_order->getInvoiceCollection()->getSize() > 0):?>
		<?php if (!$_order->getIsVirtual()): ?>
		<div class="col2-set order-info-box">
			<div class="col-1">
				<div class="box">
					<div class="box-title">
						<h2><?php echo $this->__('Billing Address') ?></h2>
					</div>
					<div class="box-content">
						<address><?php echo $_order->getBillingAddress()->format('html') ?></address>
					</div>
				</div>
			</div>
			<div class="col-2">
				<div class="box">
					<div class="box-title">
						<h2><?php echo $this->__('Shipping Address') ?></h2>
					</div>
					<div class="box-content">
						<address><?php echo $_order->getShippingAddress()->format('html') ?></address>
					</div>
				</div>
			</div>
		</div>
		<?php endif; ?>
		<div class="box box-payment">
			<div class="box-title">
				<h2><?php echo $this->__('Payment Method') ?></h2>
			</div>
			<div class="box-content">
				<?php echo $this->getPaymentInfoHtml() ?>
			</div>
		</div>
		<?php echo $this->getChildHtml('sales_order_invoice') ?>		
	<?php else:?>
		<p style="padding: 40px 0 0 20px;">We are currently processing your order!</p>
	<?php endif?>
	</div>
</div>
<script>
	jQuery(function($){
		$('#order-info').tabs();
	});
</script>


